package com.strato.mybatis.generator.v1_2_0.ui;

import java.awt.Image;
import java.awt.Toolkit;
import java.io.BufferedInputStream;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;

import javax.swing.JFrame;

public class Main {

	public static void main(String[] args){
		java.awt.EventQueue.invokeLater(new Runnable() {
            @Override
            public void run() {
        		GeneratorUITool frame = new GeneratorUITool();
        		byte[] icon=getIcon();
        		Image logo=Toolkit.getDefaultToolkit().createImage(icon);
				frame.setIconImage(logo);
        		frame.setTitle("Mybatis UI Generator ---Powered by strato.zim-soft.com");
        		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        		frame.setVisible(true);
            }

        });
	}

	private static byte[] getIcon() {
		try{
			InputStream is = Main.class.getResourceAsStream("logo2.png");
			BufferedInputStream bis=new BufferedInputStream(is);
			int i;
			ByteArrayOutputStream os=new ByteArrayOutputStream();
			while((i=bis.read())!=-1){
				os.write(i);
			}
			bis.close();
			return os.toByteArray();
		}catch(Exception e){
			e.printStackTrace();
			return null;
		}
	}
	
}
